<?php
// 注册接口
include_once 'conn.php';
$user=$_POST['user'];
$pass=$_POST['pass'];
$date=time();//获取当前时间戳
$token=md5($user.$pas.$date);
$sql=$db->query("SELECT user_name FROM user WHERE user_name = '$user'");
if ($sql -> num_rows > 0) {
    echo json_encode(['exist'=>true]);
}else{
    $db->query("ALTER TABLE user AUTO_INCREMENT = 18320120");
    $db->query("INSERT INTO 
        user (user_name,user_pass,user_token,user_update_time)
        VALUES ('$user','$pass','$token','$date')");
    echo json_encode(['token'=>$token]);
}
$db -> close();
?>